<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8" />
  <title>Emscripten Browser Test Harness</title>
  <style>
    html, body {
      margin: 0;
      padding: 0;
      height: 100%;
    }
    body {
      display: flex;
      flex-direction: column;
    }
    .topbar {
      background-color: #79f;
    }
    .full {
      border: none;
      width: 100%;
      flex: 1;
    }
  </style>
</head>
<body>
<span class="topbar">Running test <span id="count"></span>...</span>
<iframe class="full" id="iframe"></iframe>
<script>
  var counter = 0;
  function check() {
    var request = new XMLHttpRequest();
    request.open('GET', '/check');
    request.send(null);
    request.addEventListener("load", function() {
      if (request.responseText != 'False') {
        iframe.src = request.responseText;
        document.getElementById('count').textContent = counter++;
      }
      setTimeout(check, 333);
    });
    request.addEventListener("error", function() {
      document.write('Tests complete. View log in console.');
      window.close();
      return;
    });
  }
  check();
</script>
</body>
</html>

